#ifndef PLAYER_PHONON_H
#define PLAYER_PHONON_H

#include <Qt/qobject.h>

#include "../plok-model/player.h"

#include "audio_file_phonon.h"

#include <phonon/mediaobject.h>
#include <phonon/videowidget.h>
#include "string.h"

namespace Phonon {
    class MediaObject;
    class AudioOutput;
}

namespace plok {

    class Player_phonon : public QObject
    {
        Q_OBJECT

    public:
        Player_phonon();
        virtual ~Player_phonon ();

        void open (const std::string& path);
        void enqueue (const std::string& path);

        void play (void);
        void stop (void);

        void seek (qint64 time);

        qint64 totalTime (void) {return m_mediaObject->totalTime();}
    private:
        Phonon::MediaObject* m_mediaObject;
        Phonon::AudioOutput* m_audio_out;
        Phonon::VideoWidget* m_video_widget;

        QWidget m_video_window;

        // temp
        Audio_file_phonon* m_audio_file;
    private Q_SLOTS:
        void on_player_stateChanged ( Phonon::State newstate, Phonon::State oldstate );
        void on_player_timeChanged ();

    Q_SIGNALS:
        void updateTime (qint64 time);
    };

}

#endif // PLAYER_PHONON_H
